#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/1/20 14:12
# @Author  : shwy
# @Site    : http://ishwy.me
# @File    : User.py
# @Software: PyCharm
# user 表模型
from blog import db


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True)
    password = db.Column(db.String(80), nullable=False)

    def __init__(self, username, password):
        self.username = username
        self.password = password

    # 重写该方法，方便输出user信息
    def __repr__(self):
        user = ''
        user += 'username: %s\n' % (self.username)
        user += 'password: %s\n' % (self.password)

        return user